import KZJRequest from '../../index'
import { TRequestDefaultResult } from '../../type'

enum StyleMusic {
  Swiper = '/banner', //轮播图
  Recommend = '/top/playlist', //推荐歌单
  SolePlay = '/personalized/privatecontent', //独家放送
  NewrstList = 'personalized/newsong' //最新歌曲
}

export function getStyleSwiper() {
  return KZJRequest.get<TRequestDefaultResult>({
    url: StyleMusic.Swiper
  })
}

export function getRecommendList(limit = 12) {
  return KZJRequest.get<TRequestDefaultResult>({
    url: StyleMusic.Recommend,
    params: {
      offset: Number((Math.random() * (1299 - limit)).toFixed(0)) - limit,
      limit: limit
    }
  })
}

export function getSolePlay() {
  return KZJRequest.get<TRequestDefaultResult>({
    url: StyleMusic.SolePlay
  })
}

export function getNewrstList() {
  return KZJRequest.get<TRequestDefaultResult>({
    url: StyleMusic.NewrstList,
    showLoading: true
  })
}
